/*
 * File: out_leg_vmc_conv.c
 *
 * MATLAB Coder version            : 5.3
 * C/C++ source code generated on  : 17-Dec-2023 17:05:38
 */

/* Include Files */
#include "../include/matlab_code/leg_vmc_conv.h"
#include <math.h>

/* Function Definitions */
/*
 * OUT_LEG_VMC_CONV
 *     T = OUT_LEG_VMC_CONV(F,Tp,PHI1,PHI4)
 *
 * Arguments    : float F
 *                float Tp
 *                float phi1
 *                float phi4
 *                float T[2]
 * Return Type  : void
 */
void leg_vmc_conv(float F, float Tp, float phi1, float phi4, float T[2])
{
  float a_tmp;
  float t104;
  float t123_tmp;
  float t124_tmp;
  float t131;
  float t143;
  float t146;
  float t148;
  float t16_tmp_tmp;
  float t180;
  float t181;
  float t182;
  float t18_tmp_tmp;
  float t33_tmp;
  float t34_tmp;
  float t35_tmp;
  float t36_tmp;
  float t51_tmp;
  float t54_tmp;
  float t5_tmp;
  float t64_tmp;
  float t75;
  float t79;
  float t7_tmp;
  float t81;
  float t82;
  float t83;
  float t84;
  float t90;
  float t91;
  float t93;
  float t94;
  /*     This function was generated by the Symbolic Math Toolbox version 9.0.
   */
  /*     11-Dec-2023 21:37:14 */
  t148 = (float)cos(phi1);
  t5_tmp = (float)cos(phi4);
  t182 = (float)sin(phi1);
  t7_tmp = (float)sin(phi4);
  t16_tmp_tmp = t148 / 20.0F;
  t18_tmp_tmp = t182 / 20.0F;
  t33_tmp = t148 * 0.0105F;
  t34_tmp = t5_tmp * 0.0105F;
  t35_tmp = t182 * 0.0105F;
  t36_tmp = t7_tmp * 0.0105F;
  t104 = t18_tmp_tmp + -(t7_tmp / 20.0F);
  t51_tmp = (t5_tmp / 20.0F + -t16_tmp_tmp) + 0.06F;
  t54_tmp = t35_tmp + -t36_tmp;
  t64_tmp = (t34_tmp + -t33_tmp) + 0.0126F;
  t75 = t104 * t104 + t51_tmp * t51_tmp;
  t81 = t148 * t104 / 10.0F + t182 * t51_tmp / 10.0F;
  t82 = t5_tmp * t104 / 10.0F + t7_tmp * t51_tmp / 10.0F;
  t79 = t104 * t104 + t51_tmp * t51_tmp;
  t83 = t148 * t104 / 10.0F + t182 * t51_tmp / 10.0F;
  t84 = t5_tmp * t104 / 10.0F + t7_tmp * t51_tmp / 10.0F;
  t90 = 1.0F / (t64_tmp + t75);
  t91 = t90 * t90;
  t93 = 1.0F / (t64_tmp + t79);
  t94 = t93 * t93;
  t104 = (float)sqrt((t54_tmp * t54_tmp + t64_tmp * t64_tmp) + -(t75 * t75));
  t146 = 1.0F / t104;
  t104 += t36_tmp + -t35_tmp;
  t51_tmp = (float)atan(t90 * t104) * 2.0F;
  t123_tmp = (float)cos(t51_tmp);
  t124_tmp = (float)sin(t51_tmp);
  t131 = 1.0F / (t91 * (t104 * t104) + 1.0F);
  t143 = 1.0F / (t94 * (t104 * t104) + 1.0F);
  t180 =
      (t35_tmp + t81) * t91 * t104 +
      t90 * (t33_tmp + -(t146 *
                         ((t148 * t54_tmp * 0.021F + t182 * t64_tmp * 0.021F) +
                          -(t75 * t81 * 2.0F)) /
                         2.0F));
  t181 = (t36_tmp + t82) * t91 * t104 +
         t90 * (t34_tmp +
                -(t146 *
                  ((t5_tmp * t54_tmp * 0.021F + t7_tmp * t64_tmp * 0.021F) +
                   -(t75 * t82 * 2.0F)) /
                  2.0F));
  a_tmp = t18_tmp_tmp + t124_tmp * 0.105F;
  t51_tmp = (t16_tmp_tmp + t123_tmp * 0.105F) - 0.03F;
  t182 =
      (t35_tmp + t83) * t94 * t104 +
      t93 * (t33_tmp + -(t146 *
                         ((t148 * t54_tmp * 0.021F + t182 * t64_tmp * 0.021F) +
                          -(t79 * t83 * 2.0F)) /
                         2.0F));
  t94 = (t36_tmp + t84) * t94 * t104 +
        t93 * (t34_tmp +
               -(t146 *
                 ((t5_tmp * t54_tmp * 0.021F + t7_tmp * t64_tmp * 0.021F) +
                  -(t79 * t84 * 2.0F)) /
                 2.0F));
  t146 = t18_tmp_tmp + t124_tmp * 0.105F;
  t148 = (t16_tmp_tmp + t123_tmp * 0.105F) - 0.03F;
  t104 = (-t16_tmp_tmp + -(t123_tmp * 0.105F)) + 0.03F;
  t82 = t104 * t104;
  t84 = 1.0F / t104;
  t93 = t123_tmp * t143;
  t75 = t124_tmp * t143;
  t104 = a_tmp * a_tmp;
  t81 = F * (1.0F / (float)sqrt(t104 + t51_tmp * t51_tmp));
  t91 = t123_tmp * t131;
  t90 = t124_tmp * t131;
  t51_tmp = a_tmp * (1.0F / t82);
  t104 = Tp * t82 * (1.0F / (t104 + t82));
  T[0] = t81 *
             (t146 * (t16_tmp_tmp - t93 * t182 * 0.21F) * 2.0F -
              t148 * (t18_tmp_tmp - t75 * t182 * 0.21F) * 2.0F) /
             2.0F -
         t104 * (t84 * (t16_tmp_tmp - t91 * t180 * 0.21F) -
                 t51_tmp * (t18_tmp_tmp - t90 * t180 * 0.21F));
  T[1] = t81 * (t93 * t146 * t94 * 0.42F - t75 * t148 * t94 * 0.42F) / 2.0F +
         t104 * (t84 * (0.0F - t91 * t181 * 0.21F) +
                 t51_tmp * (t90 * t181 * 0.21F));
}

/*
 * File trailer for out_leg_vmc_conv.c
 *
 * [EOF]
 */
